package com.iteaj.iot.client.proxy;

import com.iteaj.iot.client.ClientProperties;
import com.iteaj.iot.client.SocketClient;
import com.iteaj.iot.client.TcpClientComponent;
import com.iteaj.network.IotProtocolFactory;
import com.iteaj.network.proxy.ProxyClientMessage;

public class ProxyClientComponent extends TcpClientComponent<ProxyClientMessage> {

    private ClientProperties.ClientProxy config;

    public ProxyClientComponent(ClientProperties.ClientProxy config) {
        this.config = config;
    }

    @Override
    protected SocketClient createClient() {
        return new ProxyClient(this, config);
    }

    @Override
    protected IotProtocolFactory createProtocolFactory() {
        return new ProxyClientProtocolFactory();
    }

    @Override
    public String getName() {
        return "代理客户端";
    }

    @Override
    public String getDesc() {
        return "用于代理对设备的操作";
    }

    @Override
    public long getReconnectTime() {
        return this.config.getReconnect();
    }
}
